<template>
    <a-table :columns="columns" :data-source="students" :row-key="rowkey"></a-table>
</template>

<script setup lang="ts">
import axios from "axios";
import {ref, computed} from "vue";
import {useRequest} from "vue-request";
import {AxiosRespList, Student} from "../model/Model8080.ts";

const {data} = useRequest<AxiosRespList<Student>>(() => axios.get('/api/students'));
console.log(data)
const students = computed(() => {
    return data.value?.data.data || []
});

function rowkey(r:Student){
    return  r.id
}

const columns = ref([{title: '编号',dataIndex:'id'}, {title: '姓名',dataIndex: 'name'}
    , {title: '性别',dataIndex: 'sex'}, {title: '年龄',dataIndex: 'age'}]);

</script>
<style scoped>

</style>
